package com.biglead.demo.controller;

import com.biglead.demo.rabbit.RabbitProducer;
import com.biglead.demo.service.IUserCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 消息队列 前端控制器
 * </p>
 *
 * @author 早起的年轻人
 * @since 2023-03-14
 */
@Api(tags = "消息队列测试")
@RestController()
@RequestMapping("/test/rabbit")
@Slf4j
public class RabbitMqController {
    @Autowired
    private RabbitProducer rabbitProducer;

    @GetMapping(value = "/testQueue1")
    @ApiOperation(value = "testQueue1 队列 ")
    public Object testQueue1() {
        rabbitProducer.sendDemoQueue();
        return "发送消息成功";
    }

    @GetMapping(value = "/sendTopicAB")
    @ApiOperation(value = "消费者A接收 ")
    public Object sendTopicAB() {
        rabbitProducer.sendTopicAB();
        return "发送消息成功";
    }
    @GetMapping(value = "/sendTopicTopicB")
    @ApiOperation(value = "消费者B接收 ")
    public Object sendTopicTopicB() {
        rabbitProducer.sendTopicTopicB();
        return "发送消息成功";
    }

}
